{extend name="index_layout"/}
{block name="main"}
<form class="layui-form" method="post">
    {:token()}
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="required" autocomplete="off" placeholder="手机号" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" lay-verify="required" autocomplete="off" placeholder="密码" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">确认密码</label>
        <div class="layui-input-block">
            <input type="password" name="password_confirm" lay-verify="required" autocomplete="off" placeholder="确认密码" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名</label>
        <div class="layui-input-block">
            <input type="text" name="name" autocomplete="off" placeholder="真实姓名" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">部门</label>
        <div class="layui-input-block">
            <input type="text" name="class" autocomplete="off" placeholder="部门" class="layui-input">
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">管理员</label>
        <div class="layui-input-block" onclick="showArea()">
            <input type="radio" name="identity" checked value="0" {if $data.identity==0}checked{/if} title="否">
            <input type="radio" name="identity" value="1" title="是" {if $data.identity==1}checked{/if}>
        </div>
    </div>


    <div class="layui-form-item" id="area" style="display: none">
        <label class="layui-form-label">区域</label>
        <div class="layui-input-inline">
            <input data-source="{:url('admin/area.index/index')}" class="layui-input selectpage" data-field='name'
                   data-primary-key="id" name="aid" type="text" value="{$data.aid}"></div>
    </div>


    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
{/block}
{block name="script"}
<script type="text/javascript">
layui.use('yznForm', function() {
    var yznForm = layui.yznForm;
    yznForm.bindevent($("form.layui-form"));
});


function showArea() {
    var identity = $('input[name="identity"]:checked').val();
    if (identity == 1) {
        $('#area').show()
    } else {
        $('#area').hide()
    }
}
</script>
{/block}